package app.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import app.config.Config;
import app.domain.Message;
import app.domain.Result;
import app.service.MessageService;

@Controller
@RequestMapping("message")
public class MessageController {
	@Autowired
	private MessageService messageService;
	
    @RequestMapping("/list")
    @ResponseBody
    public Result getMessage(Integer accountId){
 	   Result result=new Result(Config.SUCCESS_CODE,"");
 	   try{
 		   List<Message> list=messageService.getMessage(accountId);
 		   result.setRow(list);
 	   }
 	   catch(Exception e){
 		   e.printStackTrace();
 		   result.setCode(Config.FAIL_CODE);
 		   return result;
 	   }
 	   return result;
    }
    
}
